<?php

declare(strict_types=1);

namespace App\Model;


/**
 * @property int $id
 * @property int $uid 用户id
 * @property string $real_name 真实姓名
 * @property string $id_card 身份证号
 * @property string $phone 手机号
 * @property string $alipay_id 支付宝提现账号
 * @property int $alipay_id_status 支付宝账号审核状态 0未绑定 1正常 2审核中 3未通过
 * @property string $alipay_id_check_remark 支付宝审核备注
 * @property string $bank_name 银行名称
 * @property int $bank_code 银行代码
 * @property string $bank_num 银行卡账号
 * @property string $bank_address 开户行
 * @property string $bank_address_code 开户行代码
 * @property string $bank_province 开户省
 * @property string $bank_city 开户市
 * @property string $bank_area 地区
 * @property int $bank_num_check_status 提现账号审核状态 0账号未绑定 1正常 2审核中 3未通过
 * @property string $bank_num_check_remark 提现账号审核备注
 * @property int $ctime 绑定时间
 */
class WithdrawAccount extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'tb_withdraw_account';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = [];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'uid' => 'integer', 'alipay_id_status' => 'integer', 'bank_code' => 'integer', 'bank_num_check_status' => 'integer', 'ctime' => 'integer'];


    /**
     * 获取用户提现账号信息
     * @param $uid
     * @return array
     */
    public static function getAccount($uid)
    {
        // $result = $this->findAll("*","uid=?",[$uid]);
        // if(!empty($result)){
        //     return $result[0];
        // }
        // return [];
        $data = self::where('uid', $uid)->first();
        return modelToArray($data);
    }

}
